Skip to content

Forward-port #11985: remove redundant required MDO attrs (#11979)#12347

Open
gnodet wants to merge 2 commits into
maven-4.0.xfrom
fix-11979-4.0.x
Open

Forward-port #11985: remove redundant required MDO attrs (#11979)#12347
gnodet wants to merge 2 commits into
maven-4.0.xfrom
fix-11979-4.0.x

Conversation

@gnodet

@gnodet gnodet commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Forward-port of PR #11985 from maven-3.10.x to maven-4.0.x.

Removes <required>true</required> from 13 fields in maven.mdo that were never validated. No behavioral change — just corrects the model descriptor metadata.

Ref: #11979

Remove <required>true</required> from 13 metadata/defaulted fields in maven.mdo
(forward-port of PR #11985 from maven-3.10.x).
Update Model.name description to document artifactId fallback.
Add minimal POM validation tests.
@gnodet gnodet added this to the 4.0.0-rc-6 milestone Jun 23, 2026
@gnodet gnodet requested review from cstamas and mthmulders June 23, 2026 10:31
@gnodet gnodet added the mvn40 label Jun 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Forward-port of model-descriptor metadata cleanup to maven-4.0.x, removing redundant <required>true</required> flags from maven.mdo fields that are not actually validated as required, and adding regression tests/resources to ensure “minimal” raw models validate cleanly (with and without <parent>).

Changes:

  • Removed redundant required annotations from multiple fields in api/maven-api-model/src/main/mdo/maven.mdo.
  • Added “minimal” raw-model POM fixtures (with/without parent) under test resources.
  • Added compat DefaultModelValidatorTest coverage to assert zero violations for those minimal raw models.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
api/maven-api-model/src/main/mdo/maven.mdo Removes misleading required metadata; updates one field description.
compat/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java Adds new tests to validate minimal raw models with/without parent.
compat/maven-model-builder/src/test/resources/poms/validation/raw-model/minimal-with-parent.xml Test POM fixture for “minimal with parent”.
compat/maven-model-builder/src/test/resources/poms/validation/raw-model/minimal-without-parent.xml Test POM fixture for “minimal without parent”.
impl/maven-core/src/main/java/org/apache/maven/project/MavenProject.java Removes outdated TODO comment related to nullable project name.
impl/maven-impl/src/test/resources/poms/validation/raw-model/minimal-with-parent.xml Adds impl-side copy of minimal fixture (currently unused).
impl/maven-impl/src/test/resources/poms/validation/raw-model/minimal-without-parent.xml Adds impl-side copy of minimal fixture (currently unused).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 165 to 169
<field xdoc.separator="blank">
<name>name</name>
<version>3.0.0+</version>
<required>true</required>
<description>The full name of the project.</description>
<description>The full name of the project. If not specified, the artifactId will be used.</description>
<type>String</type>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — updated the description to simply say "The full name of the project." without the misleading defaulting claim. The artifactId fallback is a runtime behavior in MavenProject#getName(), not a model-level default.

Claude Opus 4.6, on behalf of Guillaume Nodet

Comment on lines +19 to +33
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.maven.validation</groupId>
<artifactId>parent</artifactId>
<version>1</version>
</parent>

<artifactId>project</artifactId>

</project>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — confirmed this file is not referenced by any test in impl/maven-impl. The compat/maven-model-builder tests have their own copy. Removed.

Claude Opus 4.6, on behalf of Guillaume Nodet

Comment on lines +19 to +29
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>groupId</groupId>
<artifactId>project</artifactId>
<version>project</version>

</project>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above — confirmed unreferenced in impl/maven-impl. The compat/maven-model-builder tests have their own copy. Removed.

Claude Opus 4.6, on behalf of Guillaume Nodet

- Fix <name> field description in maven.mdo to not claim the model field
  defaults to artifactId (the fallback is a runtime behavior in
  MavenProject#getName(), not a model-level default)
- Remove unused test POM resources minimal-with-parent.xml and
  minimal-without-parent.xml from impl/maven-impl (only referenced in
  compat/maven-model-builder tests which have their own copies)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gnodet added a commit that referenced this pull request Jun 25, 2026
- Fix <name> field description in maven.mdo to not claim the model field
  defaults to artifactId (the fallback is a runtime behavior in
  MavenProject#getName(), not a model-level default)

Note: unlike the 4.0.x branch, the test POM resources minimal-with-parent.xml
and minimal-without-parent.xml are actually referenced by tests in
impl/maven-impl on master, so they are kept.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants